$(function() {
	optFormater();
	ajaxTable();
});
function ajaxTable() {
	$('#purmjTable').datagrid({
		
		pageNumber : 1,
		loadMsg : '数据加载中,请稍后...',
		pageList : [ 10, 30, 50, 100 ],
		onLoadError : function() {
			alert('数据加载失败!');
		}
	}).datagrid('acceptChanges');
}

function optFormater() {
	var update = '';
	if(globalMaps.get('4') != undefined && miab == 'N') {
		update += "<a href='#' onclick='deletePurmimj(\""+miaa+"\")' class='easyui-linkbutton' plain='true' iconCls='icon-cancel'>删除</a>";
	}
	$("#menuDiv").html(update);
	$.parser.parse($("#menuDiv"));
}

//----------------删除End
//-------------SHENHE---
function auditPurmimj(miaa,flag) {
	changeStatus('/wms/purmj/auditPurmj.xhtml?miaa=' + miaa+ '&flag=' + flag);
	window.parent.returnValue=1;
}
function deletePurmimj(miaa) {
	$.messager.confirm('删除提示', '你确定删除该收货清单吗?', function(r) {
		if(r) {
			changeStatus('/wms/purmj/delPurmimj.xhtml?miaa=' + miaa);
			window.parent.returnValue=1;
		}
	});
}

function changeStatus(url){
	$.ajax({
		async : false,
		cache : false,
		type : 'POST',
		dataType : "text",
		url : url,
		error : function () {
			alert('请求失败');
		},
		success : function(result){
			if(result=="success") {
				alert("操作成功!");
				window.close();
			} else {
				alert(result);
			}
		}
	});
}


